(() => {
  // 获取携带或来的参数
  let list = [
    {
      img: "http://img.qxgs.cc/tiantianlaishouzu/img/investmentIn_mines/touxiang.png",
      name: "微风",
      jinbi: "25615.9",
    },
    {
      img: "http://img.qxgs.cc/tiantianlaishouzu/img/investmentIn_mines/touxiang.png",
      name: "微风",
      jinbi: "25615.9",
    },
  ];

  let rank_list = getCookie("rank_list");
  list = JSON.parse(rank_list);
  console.log(list);
  let ele = {};
  ele.wangqi_bot = $("#wangqi_bot");
  ele.top_img = $("#top_img");

  //  点击返回
  ele.top_img.onclick = () => {
    history.back();
  };
  initxuan();
  function initxuan() {
    let newList = list
      .map((item, index) => {
        if (index >= 3) {
          return ` <div class="wangqi_son">
        <div class="left">
          <div class="bg">
           <div class="bg_yuan">${index + 1}</div>
          </div>
          <img
            class="left_img"
            src="${
              item.agent_detail && item.agent_detail.head_pic
                ? IMG_DOMAIN + item.agent_detail.head_pic
                : item.agent_detail.sex == 1
                ? "http://img.qxgs.cc/tiantianlaishouzu/img/my/tx1.png"
                : "http://img.qxgs.cc/tiantianlaishouzu/img/my/tx2.png"
            }"
            alt=""
          />
          <p>${
            item.agent_detail && item.agent_detail.nick_name
              ? item.agent_detail.nick_name
              : "普通用户"
          }</p>
        </div>
        <div class="right">
          <img src="http://img.qxgs.cc/tiantianlaishouzu/img/investmentIn_mines/jinbi.png" alt="" />
          <span>${item.money}个</span>
        </div>
      </div>`;
        } else {
          return ` <div class="wangqi_son">
      <div class="left">
        <div class="bg">
          <img src="http://img.qxgs.cc/tiantianlaishouzu/img/investmentIn_mines/${index + 1}.png" alt="" />
          <!-- <div class="bg_yuan">5</div> -->
        </div>
        <img
          class="left_img"
          src="${
            item.agent_detail && item.agent_detail.head_pic
              ? IMG_DOMAIN + item.agent_detail.head_pic
              : item.agent_detail.sex
              ? "http://img.qxgs.cc/tiantianlaishouzu/img/my/tx1.png"
              : "http://img.qxgs.cc/tiantianlaishouzu/img/my/tx2.png"
          }"
          alt=""
        />
        <p>${
          item.agent_detail && item.agent_detail.nick_name
            ? item.agent_detail.nick_name
            : "普通用户"
        }</p>
      </div>
      <div class="right">
        <img src="http://img.qxgs.cc/tiantianlaishouzu/img/investmentIn_mines/jinbi.png" alt="" />
        <span>${item.money}个</span>
      </div>
    </div>`;
        }
      })
      .join(" ");
    ele.wangqi_bot.innerHTML = newList;
  }
})();
